﻿@using LdCms.EF.DbModels
@using LdCms.Common.Extension
@using LdCms.Common.Utility
@model IEnumerable<Ld_Institution_Company>
@{
    ViewData["Title"] = "List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 公司管理 <span class="c-gray en">&gt;</span> 公司管理 <span class="c-gray en">&gt;</span> 列表
    <a id="btn_refresh" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container bg-eee" style="min-height:778px;">
    <div class="cl pd-20 bg-fff text-c">
        日期范围：
        <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" id="datemin" name="datemin" class="input-text Wdate" style="width:120px;" value="@ViewBag.datemin" />
        -
        <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" id="datemax" name="datemax" class="input-text Wdate" style="width:120px;" value="@ViewBag.datemax" />
        <input type="text" class="input-text" style="width:350px" placeholder="输入公司名称、手机、邮箱" id="keyword" name="keyword" value="@ViewBag.keyword" />
        <button type="submit" class="btn btn-success radius" id="driversearch" name="driversearch" onclick="$.mainu.search()"><i class="Hui-iconfont">&#xe665;</i> 查找</button>
    </div>
    <div class="cl bg-1 pl-20 pt-10 pb-10 pr-20 mt-10">
        <span class="l">
            <a href="javascript:;" onclick="$.mainu.delBatch()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
        </span>
        <span class="r" style="padding-top:5px;">共有数据：<strong>@ViewBag.Count</strong> 条</span>
    </div>
    <div class="pd-20 bg-fff">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
                <tr class="text-c">
                    <th width="25"><input type="checkbox" name="" value=""></th>
                    <th width="80">公司编号</th>
                    <th width="200">公司名称</th>
                    <th width="80">姓名</th>
                    <th width="100">电话</th>
                    <th width="100">手机</th>
                    <th width="">地址</th>
                    <th width="120">加入时间</th>
                    <th width="70">状态</th>
                    <th width="80">操作</th>
                </tr>
            </thead>
            <tbody>
                @if (Model != null)
                {
                    foreach (var m in Model)
                    {
                        <tr class="text-c">
                            <td><input type="checkbox" name="id" value="@m.CompanyID"></td>
                            <td>@(Html.Raw(Utility.Highlight(m.CompanyID, ViewBag.keyword)))</td>
                            <td>@(Html.Raw(Utility.Highlight(m.CompanyName, ViewBag.keyword)))</td>
                            <td>@m.NickName</td>
                            <td>@m.Tel</td>
                            <td>@(Html.Raw(Utility.Highlight(m.Phone, ViewBag.keyword)))</td>
                            <td class="text-l">@m.Address</td>
                            <td>@(m.CreateDate.HasValue ? m.CreateDate.Value.ToString("yyyy-MM-dd HH:mm") : "-")</td>
                            <td class="td-status">@(m.State.ToBool() ? Html.Raw("<span class='label label-success radius'>已审核</span>") : Html.Raw("<span class='label label-defaunt radius'>待审核</span>"))</td>
                            <td class="td-manage">
                                <a title="编辑" href="javascript:;" onclick="$.mainu.edit('编辑','@Url.Action("edit", new { companyid = m.CompanyID })','','')" class="ml-5" style="text-decoration:none">编辑</a>
                            </td>
                        </tr>
                    }
                }
            </tbody>
        </table>
        <div style="width:100%; height:35px;"></div>
    </div>
</div>
@*
    --------------
    页面底部JS脚本
    --------------
*@
@section scripts{
    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="~/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script type="text/javascript" src="~/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="~/admin/lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript">
        (function ($) {
            $.mainu = {
                init: function () {
                    $('.table-sort').dataTable({
                        "aaSorting": [[1, "asc"]],//默认第几个排序
                        "bStateSave": true,//状态保存
                        "aoColumnDefs": [
                          { "orderable": false, "aTargets": [0,9] }// 制定列不参与排序
                        ]
                    });
                },
                search: function () {
                    $dateMin = $("input[name='datemin']").val();
                    $dateMax = $("input[name='datemax']").val();
                    $keyword = $("input[name='keyword']").val();
                    if ($keyword == "") {
                        if ($dateMin == "" || $dateMax=="") {
                            layer.alert('日期范围不能空', { icon: 5 });
                            return;
                        }
                    }
                    var url = "?datemin=" + $dateMin + "&datemax=" + $dateMax + "&keyword=" + $keyword + "";
                    window.location.href = url;
                },
                show: function (title, url) {
                    var index = layer.open({
                        type: 2,
                        title: title,
                        content: url
                    });
                    layer.full(index);
                },
                edit: function (title, url, w, h) {
                    layer_show(title, url, w, h);
                },
                delBatch: function () {
                    layer.msg("不可执行删除操作！", { icon: 5, time: 3000 });
                }
            };
            $(function () {
                $.mainu.init();
            });
        })(jQuery);
    </script>
}

